package com.weipai.education.controller;

import com.baidu.ueditor.ActionEnter;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;

/**
 * 百度富文本
 *
 */
@RestController
@CrossOrigin
@RequestMapping("/sys/ueditor")
public class UeditorController{
    @RequestMapping(value = "/exec")
    @ResponseBody
    public String exec(HttpServletRequest req) throws UnsupportedEncodingException {
        req.setCharacterEncoding("utf-8");
        String rootPath = req.getRealPath("/");
//        String rootPath =req.getServletContext().getRealPath("/");
//        String rootPath ="F:/javapro/education/";
        return new ActionEnter(req,rootPath).exec();
    }

}
